Skip to content

Conversation

@bembelimen
Copy link
Contributor

@bembelimen bembelimen commented Nov 15, 2025

Summary of Changes

When extending the MailTemplate class with my own implementation to override the getTemplate(...) method. The send(...) method is still using the original method.

Testing Instructions

Create the file libraries/src/Mail/MailTemplateExtended.php with the following code:

<?php

namespace Joomla\CMS\Mail;

\defined('_JEXEC') or die;

class MailTemplateExtended extends MailTemplate
{
    public static function getTemplate($key, $language)
    {
        exit('hello world');
    }
}
  • Initialize the new class:
$mailtemplate = new MailTemplateExtended('com_messages.new_message', 'en-GB');
$mailtemplate->addRecipient('[email protected]');
$mailtemplate->send();

Actual result BEFORE applying this Pull Request

The old getTemplate is called.

Expected result AFTER applying this Pull Request

The script stops with "hello world", which means, the new method is called.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@TLWebdesign
Copy link

I have tested this item ✅ successfully on 58b5996


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46448.

1 similar comment
@alikon
Copy link
Contributor

alikon commented Nov 16, 2025

I have tested this item ✅ successfully on 58b5996


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46448.

@alikon
Copy link
Contributor

alikon commented Nov 16, 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46448.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 16, 2025
@muhme muhme added the bug label Nov 16, 2025
@richard67 richard67 changed the title [5.4.] Fix static getTemplate call in mail template [5.4] Fix static getTemplate call in mail template Nov 16, 2025
@richard67 richard67 added this to the Joomla! 5.4.2 milestone Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug PR-5.4-dev RTC This Pull Request is Ready To Commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants